package com.example.yonghucenter.domain.dto;

import java.io.Serializable;

/**
 * 用户信息修改用 DTO
 */
public class UserDTO implements Serializable {

    private Long id;

    /**
     * 昵称
     */
    private String username;

    /**
     * 登录账号
     */
    private String userAccount;

    /**
     * 头像地址
     */
    private String avatarUrl;

    /**
     * 性别: 0-未知, 1-男, 2-女
     */
    private Integer gender;

    /**
     * 电话
     */
    private String phone;

    /**
     * 邮箱
     */
    private String email;

    /**
     * 用户状态: 0-正常, 1-禁用
     */
    private Integer userStatus;

    /**
     * 是否删除: 0-未删除, 1-已删除
     */
    private Integer isDelete;

    /**
     * 用户角色: 0-普通用户, 1-管理员
     */
    private Integer userRole;

    // ========================
    // Getter 和 Setter 方法
    // ========================

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getUserAccount() {
        return userAccount;
    }

    public void setUserAccount(String userAccount) {
        this.userAccount = userAccount;
    }

    public String getAvatarUrl() {
        return avatarUrl;
    }

    public void setAvatarUrl(String avatarUrl) {
        this.avatarUrl = avatarUrl;
    }

    public Integer getGender() {
        return gender;
    }

    public void setGender(Integer gender) {
        this.gender = gender;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Integer getUserStatus() {
        return userStatus;
    }

    public void setUserStatus(Integer userStatus) {
        this.userStatus = userStatus;
    }

    public Integer getIsDelete() {
        return isDelete;
    }

    public void setIsDelete(Integer isDelete) {
        this.isDelete = isDelete;
    }

    public Integer getUserRole() {
        return userRole;
    }

    public void setUserRole(Integer userRole) {
        this.userRole = userRole;
    }

    // ========================
    // 可选：toString / equals / hashCode 方法
    // ========================

    @Override
    public String toString() {
        return "UserDTO{" +
                "id=" + id +
                ", username='" + username + '\'' +
                ", userAccount='" + userAccount + '\'' +
                ", avatarUrl='" + avatarUrl + '\'' +
                ", gender=" + gender +
                ", phone='" + phone + '\'' +
                ", email='" + email + '\'' +
                ", userStatus=" + userStatus +
                ", isDelete=" + isDelete +
                ", userRole=" + userRole +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof UserDTO)) return false;

        UserDTO userDTO = (UserDTO) o;

        if (getId() != null ? !getId().equals(userDTO.getId()) : userDTO.getId() != null) return false;
        if (getUsername() != null ? !getUsername().equals(userDTO.getUsername()) : userDTO.getUsername() != null)
            return false;
        if (getUserAccount() != null ? !getUserAccount().equals(userDTO.getUserAccount()) : userDTO.getUserAccount() != null)
            return false;
        if (getAvatarUrl() != null ? !getAvatarUrl().equals(userDTO.getAvatarUrl()) : userDTO.getAvatarUrl() != null)
            return false;
        if (getGender() != null ? !getGender().equals(userDTO.getGender()) : userDTO.getGender() != null)
            return false;
        if (getPhone() != null ? !getPhone().equals(userDTO.getPhone()) : userDTO.getPhone() != null)
            return false;
        if (getEmail() != null ? !getEmail().equals(userDTO.getEmail()) : userDTO.getEmail() != null)
            return false;
        if (getUserStatus() != null ? !getUserStatus().equals(userDTO.getUserStatus()) : userDTO.getUserStatus() != null)
            return false;
        if (getIsDelete() != null ? !getIsDelete().equals(userDTO.getIsDelete()) : userDTO.getIsDelete() != null)
            return false;
        return getUserRole() != null ? getUserRole().equals(userDTO.getUserRole()) : userDTO.getUserRole() == null;
    }

    @Override
    public int hashCode() {
        int result = getId() != null ? getId().hashCode() : 0;
        result = 31 * result + (getUsername() != null ? getUsername().hashCode() : 0);
        result = 31 * result + (getUserAccount() != null ? getUserAccount().hashCode() : 0);
        result = 31 * result + (getAvatarUrl() != null ? getAvatarUrl().hashCode() : 0);
        result = 31 * result + (getGender() != null ? getGender().hashCode() : 0);
        result = 31 * result + (getPhone() != null ? getPhone().hashCode() : 0);
        result = 31 * result + (getEmail() != null ? getEmail().hashCode() : 0);
        result = 31 * result + (getUserStatus() != null ? getUserStatus().hashCode() : 0);
        result = 31 * result + (getIsDelete() != null ? getIsDelete().hashCode() : 0);
        result = 31 * result + (getUserRole() != null ? getUserRole().hashCode() : 0);
        return result;
    }
}
